// This example shows how to obtain all method nodes under a given node of the OPC-UA address space. // For each node, it displays its browse name and node ID. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System; using OpcLabs.EasyOpc.UA; using OpcLabs.EasyOpc.UA.AddressSpace; using OpcLabs.EasyOpc.UA.OperationModel; namespace UADocExamples._EasyUAClient { class BrowseMethods { public static void Overload2() { UAEndpointDescriptor endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"; // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) // or "https://opcua.demo-this.com:51212/UA/SampleServer/" // Instantiate the client object var client = new EasyUAClient(); // Obtain methods under the specified node. UANodeElementCollection nodeElementCollection; try { nodeElementCollection = client.BrowseMethods(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10755"); } catch (UAException uaException) { Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}"); return; } // Display results foreach (UANodeElement nodeElement in nodeElementCollection) Console.WriteLine($"{nodeElement.BrowseName}: {nodeElement.NodeId}"); } // Example output: //ScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10756 //ScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10759 //ScalarMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10762 //ArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10765 //ArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10768 //ArrayMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10771 //UserScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10774 //UserScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10777 //UserArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10780 //UserArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10783 } }
# This example shows how to obtain all method nodes under a given node of the OPC-UA address space. # For each node, it displays its browse name and node ID. # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in PowerShell on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PowerShell . # Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own # a commercial license in order to use Online Forums, and we reply to every post. #requires -Version 5.1 using namespace OpcLabs.EasyOpc.UA using namespace OpcLabs.EasyOpc.UA.OperationModel # The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows . Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUA.dll" Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUAComponents.dll" [UAEndpointDescriptor]$endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" # or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) # or "https://opcua.demo-this.com:51212/UA/SampleServer/" # Instantiate the client object. $client = New-Object EasyUAClient # Obtain methods under the specified node. try { $nodeElementCollection = [IEasyUAClientExtension]::BrowseMethods($client, $endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10755") } catch [UAException] { Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)" return } # Display results foreach ($nodeElement in $nodeElementCollection) { Write-Host "$($nodeElement.BrowseName): $($nodeElement.NodeId)" } # Example output: # #ScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10756 #ScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10759 #ScalarMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10762 #ArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10765 #ArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10768 #ArrayMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10771 #UserScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10774 #UserScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10777 #UserArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10780 #UserArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10783
' This example shows how to obtain all method nodes under a given node of the OPC-UA address space. ' For each node, it displays its browse name and node ID. ' ' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . ' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET . ' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own ' a commercial license in order to use Online Forums, and we reply to every post. Imports OpcLabs.EasyOpc.UA Imports OpcLabs.EasyOpc.UA.AddressSpace Imports OpcLabs.EasyOpc.UA.OperationModel Namespace _EasyUAClient Friend Class BrowseMethods Public Shared Sub Overload2() ' Define which server we will work with. Dim endpointDescriptor As UAEndpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) ' or "https://opcua.demo-this.com:51212/UA/SampleServer/" ' Instantiate the client object Dim client = New EasyUAClient() ' Obtain methods under the specified node. Dim nodeElementCollection As UANodeElementCollection Try nodeElementCollection = client.BrowseMethods(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10755") Catch uaException As UAException Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}") Exit Sub End Try ' Display results For Each nodeElement As UANodeElement In nodeElementCollection Console.WriteLine($"{nodeElement.BrowseName}: {nodeElement.NodeId}") Next nodeElement End Sub ' Example output: 'ScalarMethod1 nsu = http 'test.org/UA/Data/ ;ns=2;i=10756 'ScalarMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10759 'ScalarMethod3: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10762 'ArrayMethod1: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10765 'ArrayMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10768 'ArrayMethod3: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10771 'UserScalarMethod1: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10774 'UserScalarMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10777 'UserArrayMethod1: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10780 'UserArrayMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10783 End Class End Namespace
// This example shows how to obtain all method nodes under a given node of the OPC-UA address space. // For each node, it displays its browse name and node ID. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. #include "stdafx.h" // Includes "QuickOpc.h", and other commonly used files #include "BrowseMethods.h" namespace _EasyUAClient { void BrowseMethods::Main() { // Initialize the COM library CoInitializeEx(NULL, COINIT_MULTITHREADED); { // Instantiate the client object _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient)); // Perform the operation _UANodeElementCollectionPtr NodeElementsPtr = ClientPtr->BrowseMethods( //L"http://opcua.demo-this.com:51211/UA/SampleServer", L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", L"nsu=http://test.org/UA/Data/ ;i=10755"); // Display results IEnumVARIANTPtr EnumNodeElementPtr = NodeElementsPtr->GetEnumerator(); _variant_t vNodeElement; while (EnumNodeElementPtr->Next(1, &vNodeElement, NULL) == S_OK) { _UANodeElementPtr NodeElementPtr(vNodeElement); _tprintf(_T("%s: "), (LPCTSTR)CW2CT(NodeElementPtr->BrowseName->ToString)); _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(NodeElementPtr->NodeId->ToString)); vNodeElement.Clear(); } } // Release all interface pointers BEFORE calling CoUninitialize() CoUninitialize(); } }
// This example shows how to obtain all method nodes under a given node of // the OPC-UA address space. For each node, it displays its browse name and // node ID. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. class procedure BrowseMethods.Main; var Client: EasyUAClient; Count: Cardinal; Element: OleVariant; NodeElement: _UANodeElement; NodeElementEnumerator: IEnumVariant; NodeElements: _UANodeElementCollection; begin // Instantiate the client object Client := CoEasyUAClient.Create; NodeElements := Client.BrowseMethods( //'http://opcua.demo-this.com:51211/UA/SampleServer', 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer', 'nsu=http://test.org/UA/Data/ ;i=10755'); NodeElementEnumerator := NodeElements.GetEnumerator; while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do begin NodeElement := IUnknown(Element) as _UANodeElement; WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString); end; end;
// This example shows how to obtain all method nodes under a given node of // the OPC-UA address space. For each node, it displays its browse name and // node ID. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client and subscriber examples in Object Pascal (Delphi) on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-OP . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. class procedure BrowseMethods.Main; var Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient; Count: Cardinal; Element: OleVariant; NodeElement: _UANodeElement; NodeElementEnumerator: IEnumVariant; NodeElements: _UANodeElementCollection; begin // Instantiate the client object Client := CoEasyUAClient.Create; try NodeElements := Client.BrowseMethods( //'http://opcua.demo-this.com:51211/UA/SampleServer', //'https://opcua.demo-this.com:51212/UA/SampleServer/', 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer', 'nsu=http://test.org/UA/Data/ ;i=10755'); except on E: EOleException do begin WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message])); Exit; end; end; NodeElementEnumerator := NodeElements.GetEnumerator; while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do begin NodeElement := IUnknown(Element) as _UANodeElement; WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString); end; // Example output: // ScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10756 // ScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10759 // ScalarMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10762 // ArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10765 // ArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10768 // ArrayMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10771 // UserScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10774 // UserScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10777 // UserArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10780 // UserArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10783 end;
// This example shows how to obtain all method nodes under a given node of the OPC-UA address space. // For each node, it displays its browse name and node ID. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client and subscriber examples in PHP on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PHP . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. // Instantiate the client object $Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient"); // Perform the operation try { $NodeElements = $Client->BrowseMethods( //"http://opcua.demo-this.com:51211/UA/SampleServer", "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755"); } catch (com_exception $e) { printf("*** Failure: %s\n", $e->getMessage()); Exit(); } // Display results foreach ($NodeElements as $NodeElement) { printf("s: s\n", $NodeElement->BrowseName, $NodeElement->NodeId); }
REM This example shows how to obtain all method nodes under a given node of the OPC-UA address space. REM For each node, it displays its browse name and node ID. REM REM Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . REM OPC client and subscriber examples in Visual Basic on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VB . REM Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own REM a commercial license in order to use Online Forums, and we reply to every post. Public Sub BrowseMethods_Main_Command_Click() OutputText = "" ' Instantiate the client object Dim Client As New EasyUAClient ' Perform the operation On Error Resume Next Dim NodeElements As UANodeElementCollection Set NodeElements = Client.BrowseMethods("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755") If Err.Number <> 0 Then OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf Exit Sub End If On Error GoTo 0 ' Display results Dim NodeElement: For Each NodeElement In NodeElements OutputText = OutputText & NodeElement.BrowseName & ": " & NodeElement.NodeId & vbCrLf Next End Sub
Rem This example shows how to obtain all method nodes under a given node of the OPC-UA address space. Rem For each node, it displays its browse name and node ID. Rem Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript . Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own Rem a commercial license in order to use Online Forums, and we reply to every post. Option Explicit ' Instantiate the client object Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient") ' Perform the operation On Error Resume Next Dim NodeElements: Set NodeElements = Client.BrowseMethods("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755") If Err.Number <> 0 Then WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description WScript.Quit End If On Error Goto 0 ' Display results Dim NodeElement: For Each NodeElement In NodeElements WScript.Echo NodeElement.BrowseName & ": " & NodeElement.NodeId Next ' Example output: 'ScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10756 'ScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10759 'ScalarMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10762 'ArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10765 'ArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10768 'ArrayMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10771 'UserScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10774 'UserScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10777 'UserArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10780 'UserArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10783
# This example shows how to obtain all method nodes under a given node of the OPC-UA address space. # For each node, it displays its browse name and node ID. # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python . # Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own # a commercial license in order to use Online Forums, and we reply to every post. # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc # Import .NET namespaces. from OpcLabs.EasyOpc.UA import * from OpcLabs.EasyOpc.UA.AddressSpace import * from OpcLabs.EasyOpc.UA.OperationModel import * endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer') # or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported) # or 'https://opcua.demo-this.com:51212/UA/SampleServer/' # Instantiate the client object. client = EasyUAClient() # Obtain methods under the specified node. try: nodeElementCollection = IEasyUAClientExtension.BrowseMethods(client, endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10755')) except UAException as uaException: print('*** Failure: ' + uaException.GetBaseException().Message) exit() # Display results. for nodeElement in nodeElementCollection: print(nodeElement.BrowseName, ': ', nodeElement.NodeId, sep='')
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Documentation Home, Send Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.